<div id="myRecipes">
<?php 
  $difficult = array(
    0=>"新手",
    1=>"初级",
    2=>"初中",
    3=>"中级",
    4=>"高级",
    5=>"厨神"
  );
  $usergroup = $_SESSION['usergroup'];
  $userid    = $_SESSION['userid'];
  $pageOwner = $user['User']['id'];
  if (count($posts) == 0) echo '<div class="noContent">还没有内容呐<br />╮(╯▽╰)╭</div>';
  else foreach ($posts as $post):
?>
        <div class="recipeItem">
          <div class="recipeItemTitle">
          <?php echo $this->Html->link($post['Recipe']['name'],array('controller'=>'recipes','action' => 'details', $post['Recipe']['id']));
          ?>
          </div>
            <?php if (($userid == $pageOwner)||($usergroup == 1)) echo '<div class="operation">'.$this->Html->link(
                '删除',
                array('controller'=>'recipes',
                'action' => 'delete',
                $post['Recipe']['id']),
                array(),
                '确定删除么？'
              ).'|'.$this->Html->link(
              '修改', 
              array('controller'=>'users',
              'action' => 'modifyRecipe',
              $post['Recipe']['id'])).'</div>';
            ?>

          <div class="recipeItemStar">(评级：
          <?php
            echo $post['Recipe']['currentScore'];
          ?>)</div>
          <div class="clearFix"></div>
          <a class="recipeItemImageWrap"><img class="recipeItemImage" src="<?php echo $post['Recipe']['img']; ?>"/></a>
          <div class="recipeItemDescription"><?php echo $post['Recipe']['description']; ?></div>
          <div class="recipeItemTags">标签
          <?php 
            $tag_array = explode(" ",$post['Recipe']['tags']);
            $number = count($tag_array);
            for($i = 0; $i < $number; $i++){
              echo "<a>".$tag_array[$i]."</a>";
            }
          ?></div>
          <div class="clearFix"></div>
          <div class="recipeItemTaste">口味:<a><?php echo $post['Recipe']['taste']; ?></a></div>
          <div class="recipeItemMethod">|工艺:<a><?php echo $post['Recipe']['method']; ?></a></div>
          <div class="recipeItemDifficulty">|难度:<a><?php echo $difficult[$post['Recipe']['difficulty']]; ?></a></div>
          <div class="recipeItemComment">|评论(<a><?php echo $post['Recipe']['commentsNumber']; ?></a>)</div>
          <div class="clearFix"></div>
        </div>
  <?php endforeach; ?>
</div>
<div class="clearFix"></div>
<?php 
  echo $this->element('paginator');
?>
</div>